package com.example.bailin.giftsay.hot;

import android.content.Intent;
import android.widget.ListView;

import com.example.bailin.giftsay.R;
import com.example.bailin.giftsay.baseclass.BaseFragment;
import com.example.bailin.giftsay.entity.AppraiseEntity;
import com.example.bailin.giftsay.entity.HotEntity;
import com.example.bailin.giftsay.hot.adapter.HotPLAdapter;
import com.example.bailin.giftsay.tool.NetTool;
import com.example.bailin.giftsay.tool.UrlProvide;

/**
 * Created by bailin on 16/8/30.
 */
public class HotPLFragment extends BaseFragment {

    private ListView lv;

    @Override
    protected int setLayout() {
        return R.layout.fragment_selection;
    }

    @Override
    protected void initView() {
        lv = bindView(R.id.lv_selection);
    }

    @Override
    protected void initData() {
        Intent intent = getActivity().getIntent();
        int id = intent.getIntExtra("id", 0);

        tool().getData(UrlProvide.HOT_APPRAISE + id + UrlProvide.HOT_APPRAISE1, AppraiseEntity.class, new NetTool.NetInterface<AppraiseEntity>() {
            @Override
            public void onSuccess(AppraiseEntity appraiseEntity) {
                HotPLAdapter adapter = new HotPLAdapter();
                adapter.setEntity(appraiseEntity);
                lv.setAdapter(adapter);
            }

            @Override
            public void onError(String errorMsg) {

            }
        });

    }
}
